package com.li.springbootproject.spring.beaninit;

import com.lidong.toolkit.constant.LogConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 实现 InitializingBean 接口重写 afterPropertiesSet()
 *
 * @author LiDong
 * @version 1.0.0
 * @createTime 3/12/2022 4:06 PM
 */
@Configuration
public class InitializingBeanExampleTest {

    private static final Logger logger = LoggerFactory.getLogger(InitializingBeanExampleTest.class);

    @Bean
    public InitializingBeanExample initializingBeanExample() {
        InitializingBeanExample initializingBeanExample = new InitializingBeanExample();
        initializingBeanExample.setId(1);
        initializingBeanExample.setName("test1");
        logger.info(LogConst.LOG_SUCCESS_PREFIX + initializingBeanExample);
        return initializingBeanExample;
    }
}
